package com.star.uc.biz;

import com.star.uc.contract.query.RenderAuthQuery;
import com.star.uc.factory.login.LoginTypeFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 授权跳转url地址处理器
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/12/19 17:48
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AuthorizeRenderBizService {

    private final LoginTypeFactory loginTypeFactory;


    /**
     * 生成授权地址
     *
     * @param renderAuthQuery 授权参数
     * @return 授权地址
     */
    public String renderAuth(RenderAuthQuery renderAuthQuery) {
        return loginTypeFactory.route(renderAuthQuery.getLoginType()).getAuthorizeUrl(renderAuthQuery);
    }
}
